#ifndef COLORPATTLE_H
#define COLORPATTLE_H

#include "uwidget.h"

class UColorPickerPrivate;
class UTKWIDGET_EXPORT UColorPicker : public UWidget
{
    Q_OBJECT
public:
    explicit UColorPicker(QWidget* parent = nullptr);
    ~UColorPicker();

    void setShowColorText(bool isShow);

    void setColor(const QColor &color);

    QColor color() const;

signals:
    void colorChanged(const QColor &color);

protected:
    void paintEvent(QPaintEvent* event) override;

    void mousePressEvent(QMouseEvent* event) override;

    void mouseMoveEvent(QMouseEvent* event) override;

    void mouseReleaseEvent(QMouseEvent* event) override;

private:
    QScopedPointer<UColorPickerPrivate> d_ptr;
    Q_DISABLE_COPY(UColorPicker)
    Q_DECLARE_PRIVATE_D(d_ptr, UColorPicker)
};

#endif // COLORPATTLE_H
